#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>

namespace Ui {
    class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();

    bool loadList(QString path);

public slots:
    void showHasListChanged(bool changed);
    void showHasListSaved(bool saved);

private slots:
    void on_addButton_clicked();
    void on_deleteButton_clicked();
    void on_doneButton_clicked();
    void on_saveButton_clicked();
    void on_loadButton_clicked();

signals:
    void hasListChanged(bool changed);
    void hasListSaved(bool saved);

protected:
    virtual void closeEvent(QCloseEvent *);

private:
    QString _filePath;

    QString _windowTitleName;
    QString _windowTitleChanged;
    QString _windowTitleSaved;

    Ui::Widget *ui;

    bool _flagYesNo;

    void addItemToList(QString name, bool checked = false);

    bool wantContinue();
    bool saved();

    bool saveList(QString path);
};

#endif // WIDGET_H
